package com.xsp.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author xsp
 * @date 2024/2/5
 * @desc
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    public User(Integer id, String username, String password) {
        this.id = id;
        this.username = username;
        this.password = password;
    }

    private Integer id;
    private String username;
    private String password;
    private Integer age;
    // 处理同步表单提交的日期格式，springmvc自动将日期字符串转为Date
//    @DateTimeFormat(pattern = "yyyy-MM-dd")
    // 处理和响应异步表单提交的日期格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date bornDate;
    // 保存上传后的图片的地址
    private String photo;
}
